ANTLR: A Predicated- LL(k) Parser Generator
نویسندگان
چکیده
Despite the parsing power of LR=LALR algorithms, e.g. YACC 1, programmers often choose to write recursive-descent parsers by hand to obtain increased flexibility, better error handling, and ease of debugging. We introduce ANTLR, a public-domain parser generator that combines the flexibility of hand-coded parsing with the convenience of a parser generator, which is a component of PCCTS 2. ANTLR has many features that make it easier to use than other language tools. Most important, ANTLR provides predicates which let the programmer systematically direct the parse via arbitrary expressions using semantic and syntactic context; in practice, the use of predicates eliminates the need to hand-tweak the ANTLR output, even for difficult parsing problems. ANTLR also integrates the description of lexical and syntactic analysis, accepts LL(k) grammars for k > 1 with extended BNF notation, and can automatically generate abstract syntax trees. ANTLR is widely used, with over 1000 registered industrial and academic users in 37 countries. It has been ported to many popular systems such as the PC, Macintosh, and a variety of UNIX platforms; a commercial C++ front-end has been developed as a result of one of our industrial collaborations.
منابع مشابه
The Use of Predicates In LL(k) And LR(k) Parser Generators (Technical Summary)
Although existing LR(1) or U ( 1 ) parser generators suffice for many language recognition problems, writing a straightforward grammar to translate a complicated language, such as C++ or even C, remains a non-trivial task. We have often found that adding translation actions to the grammar is harder than writing the grammar itself. Part of the problem is that many languages are context-sensitive...
متن کاملAdding Semantic and Syntactic Predicates To LL(k): pred-LL(k)
Most language translation problems can be solved with existing LALR(1) or LL(k) language tools; e.g., YACC Joh78] or ANTLR PDC92]. However, there are language constructs that defy almost all parsing strategy commonly in use. Some of these constructs cannot be parsed without semantics, such as symbol table information, and some cannot be properly recognized without rst examining the entire const...
متن کاملPSOA2TPTP: A Reference Translator for Interoperating PSOA RuleML with TPTP Reasoners
PSOA RuleML is a recently specified rule language combining relational and object-oriented modeling. In order to provide reasoning services for PSOA RuleML, we have implemented a reference translator, PSOA2TPTP, to map knowledge bases and queries in the PSOA RuleML presentation syntax (PSOA/PS) to the popular TPTP format, supported by many first-order logic reasoners. In particular, PSOA RuleML...
متن کاملAn Implementation of a Fast Threaded Nondeterministic LL(*) Parser Generator
This paper proposes separating the semantic actions’ execution from the parsing phase. The parser generates a queue of semantic actions attached with grammar rules to be visited in case of successful parsing. By this separation, the execution time of the parsing phase can be enhanced. More importantly, this will avoid the incorrect execution of semantic actions when dealing with non-determinist...
متن کاملTangent-Linear Models by Augmented LL-Parsers
We describe a novel method for the generation of tangent-linear code by augmentation of LL-parsers generated by the software tool ANTLR. The main advantage of this approach to source code augmentation is the missing requirement for an internal representation of the original program. We consider this work as the basis for further investigations into how far this technique can be extended in the ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید
ثبت ناماگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید
ورودعنوان ژورنال:
- Softw., Pract. Exper.
دوره 25 شماره
صفحات -
تاریخ انتشار 1995